package ae.pcfc.cldos.online.web.services.breadcrumbs.provider;

import java.util.ArrayList;
import java.util.List;

import ae.pcfc.cldos.online.web.services.breadcrumbs.BreadCrumb;
import ae.pcfc.cldos.online.web.services.breadcrumbs.beans.BreadCrumbBean;

/**
 * 
 * @author arosa
 *
 */
public class BreadCrumbImpl implements BreadCrumb {
	
	private List<BreadCrumbBean> breadCrumb;
	
	private BreadCrumbImpl(BreadCrumbBean breadCrumbBean, BreadCrumb parent){
		this.breadCrumb = new ArrayList<BreadCrumbBean>();
		if(parent!=null){
			this.breadCrumb.addAll(parent.getBreadCrumb());
		}
		this.breadCrumb.add(breadCrumbBean);
	}
	
	
	public List<BreadCrumbBean> getBreadCrumb(){
		return breadCrumb;
	}
	
	public static final BreadCrumb createBaseBreadCrumb(BreadCrumbBean breadCrumbBean){
		return new BreadCrumbImpl(breadCrumbBean, null);
	}
	
	public static final BreadCrumb createBreadCrumb(BreadCrumbBean breadCrumbBean, BreadCrumb parent){
		return new BreadCrumbImpl(breadCrumbBean, parent);
	}
}
